package framework.apache.poi;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.model.io.HWPFOutputStream;
import org.apache.poi.hwpf.usermodel.Paragraph;
import org.apache.poi.hwpf.usermodel.Range;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;

import util.file.fileUtil;
public class docTest extends fileUtil {
	public static void main(String[] args) throws Exception {
		outdoc1();
	}
	public static void indoc1() throws Exception {
		initialize(file1, file2);
		POIFSFileSystem poifs = new POIFSFileSystem(fis);
		HWPFDocument doc = new HWPFDocument(poifs);
		Range range = doc.getRange();
		for (int i = 0; i < range.numParagraphs(); i++) {
			Paragraph p0 = range.getParagraph(i);
			System.out.println(p0.text());
			System.out.println(p0);
		}
		fis.close();
	}
	public static void outdoc1() throws Exception {
		initialize(file1, file2);
		String str = "的第四法国gfdgdfgfd所得罚款都算疯狂大蒜东方节课了";
		HWPFOutputStream hwpfos = new HWPFOutputStream();
		hwpfos.write(new byte[]{13});
		hwpfos.write(str.getBytes());
		hwpfos.writeTo(fos);
	}
}
